#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSqlDatabase>
#include <QSqlTableModel>
#include <QMessageBox>
#include <QSqlQuery>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QString id,QSqlDatabase* db,QWidget *parent = nullptr);
    ~MainWindow();

private slots:
    void on_pushButton_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_4_clicked();

    void on_actMenuMange_triggered();

    void on_actOrderMange_triggered();

    void on_actSeatMange_triggered();

    void on_actPayMange_triggered();

    void on_actMain_triggered();

    void on_btnAppdenMenu_clicked();

    void on_btnDeleteMenu_clicked();

    void on_btnResetMenu_clicked();

    void on_btnSubmitMenu_clicked();

    void on_btnAppendSeat_clicked();

    void on_btnDeleteSeat_clicked();

    void on_btnResetSeat_clicked();

    void on_btnSubmitSeat_clicked();

    void on_btnAppendPay_clicked();

    void on_btnDeletePay_clicked();

    void on_btnResetPay_clicked();

    void on_btnSubmitPay_clicked();

    void on_btnDeleteOrder_clicked();

    void on_btnResetOrder_clicked();

    void on_btnSubmitOrder_clicked();

    void on_tvOrder_doubleClicked(const QModelIndex &index);

private:
    Ui::MainWindow *ui;

    QSqlDatabase m_db;//记录数据库连接
    QString m_adminId;//记录管理员id

    QSqlTableModel* m_menuModel;
    QSqlTableModel* m_orderModel;
    QSqlTableModel* m_seatModel;
    QSqlTableModel* m_payModel;

    void iniModel();//初始化数据库表格信息

};
#endif // MAINWINDOW_H
